<div class="main_body">
	<div id="left_column">
    <?php echo $this->element('main_menu')?>		
  	<?php echo $this->element('/messages/search_form')?>
    </div>    	
	<div id="main_body_content">

		<div class="messages index">
			<h1><?php echo $statusy[$status[0]]?></h1>
			<table cellpadding="0" cellspacing="0">
			<tr>
					<th width="3%">
						<?php echo $this->Paginator->sort(__("T",true),'status');?>
					</th>
					<th width="50%">
						<?php echo $this->Paginator->sort(__("Subject",true),'name');?>
					</th>
					<th width="10%">
						<?php echo $this->Paginator->sort('added');?>
					</th>					
					<th width="20%">
						<?php 
							if($status[0] == 1 || $status[0] == 3){
								$column_name = __("From",true);
							}else if($status[0] == 2){
								$column_name = __("To",true);
							}else{
								$column_name = __("From / To",true);
							}
							echo $this->Paginator->sort($column_name,'fromto');
						?>
					</th>
					<th class="actions" width="17%"><?php __("Actions");?></th>
			</tr>
			<?php
			$i = 0;
			foreach ($messages as $message):
				$class = null;
				if ($i++ % 2 == 0) {
					$class = ' class="altrow"';
				}
			?>
			<tr<?php echo $class;?>>
				<td><?php echo $html->image(HOST."/actions_16_message_status_{$message['Message']['status']}.png")?></td>
				<td><?php echo $this->Html->link($message['Message']['name'],array('action' => 'view', $message['Message']['id'])); ?></td>
				<td><?php echo $message['Message']['added']; ?></td>
				<td>
					<?php echo $this->Html->link($message['Message']['fromto'],array('action'=>'add',$message['Message']['fromto_user_id'])); ?>&nbsp;
				</td>
				<td class="actions">
					<?php echo $this->Html->link($html->image(HOST.'/actions_16_message_open.png'), array('action' => 'view', $message['Message']['id']),array('escape'=>false,'title'=>__("Open", true))); ?>
					<?php echo $this->Html->link($html->image(HOST.'/actions_16_message_re.png'), array('action' => 'edit', $message['Message']['id']),array('escape'=>false,'title'=>__("Re", true))); ?>
					<?php echo $this->Html->link($html->image(HOST.'/actions_16_message_delete.png'), array('action' => 'delete', $message['Message']['id']), array('escape'=>false,'title'=>__("Delete", true)), sprintf(__("Are you sure you want to delete # %s?", true), $message['Message']['id'])); ?>					
				</td>
			</tr>
		<?php endforeach; ?>
			</table>
			<p>
			<?php
			echo $this->Paginator->counter(array(
			'format' => __("Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%", true)
			));
			?>	</p>
		
			<div class="paging">
				<?php echo $this->Paginator->prev('<< ' . __('previous', true), array(), null, array('class'=>'disabled'));?>
			 | 	<?php echo $this->Paginator->numbers();?>
		 |
				<?php echo $this->Paginator->next(__('next', true) . ' >>', array(), null, array('class' => 'disabled'));?>
			</div>
		</div>
		
		
		<div class="clr"></div>	
	</div>			
	<?php echo $this->element('languages')?>	
	<div class="clr"></div>
</div>	
<div class="clr"></div>	
<div class="main_action">
	<div class="main_action_content">
	
			
		<div class="actions">
			<h3><?php __("Actions"); ?></h3>
			<ul>
				<li><?php echo $this->Html->link($html->image(HOST.'/actions_message_add.png'), array( 'action' => 'add'),array('escape'=>false,'title'=>__("New Message", true))); ?> <div class="clr"></div> <?php echo __("New Message", true)?></li>
				<li><?php echo $this->Html->link($html->image(HOST.'/actions_message_inbox.png'), array( 'action' => 'index',1),array('escape'=>false,'title'=>__("Inbox", true))); ?> <div class="clr"></div> <?php echo __("Inbox", true)?></li>
				<li><?php echo $this->Html->link($html->image(HOST.'/actions_message_outbox.png'), array( 'action' => 'index',2),array('escape'=>false,'title'=>__("Outbox", true))); ?> <div class="clr"></div> <?php echo __("Outbox", true)?></li>				
				<li><?php echo $this->Html->link($html->image(HOST.'/actions_message_archivies.png'), array( 'action' => 'index',3),array('escape'=>false,'title'=>__("Archives", true))); ?> <div class="clr"></div> <?php echo __("Archives", true)?></li>				
				<li><?php echo $this->Html->link($html->image(HOST.'/actions_messages_deleted.png'), array( 'action' => 'index',4),array('escape'=>false,'title'=>__("Deleted Items", true))); ?> <div class="clr"></div> <?php echo __("Deleted Items", true)?></li>
			</ul>
		</div>
		
		<div class="clr"></div>
	</div>		
</div>		